package com.ysmygx.utils;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice("com.ysmygx")
public class GlobalExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    public R businessExceptionHandler(BusinessException exception){
        return R.failed(exception.getMessage());
    }

    @ExceptionHandler(Exception.class)
    public R otherExceptionHandler(Exception ex){
        return R.failed(ex.getMessage());
    }
}
